<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增简历')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <!-- <script src="../../../ruoyi/js/ry-ui.js"></script> -->
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-resume-add">
        <!-- <form class="form-horizontal m" id="form-resume-add"  method="post" action="add"> -->
            <h4 class="form-header h4">简历信息</h4>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">简历文件路径：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="resFile" required>
                    <div class="file-loading">
                        <input class="form-control file-upload" id="resFile" name="file" type="file" >
                    </div>
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">面试回数：</label>
                <div class="col-sm-8">
                    <input name="resNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" hidden>    
                <label class="col-sm-3 control-label">面试状态：</label>
                <div class="col-sm-8">
                    <input name="resStatus" class="form-control" type="text" value="10">
                </div>
            </div>
            
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">面试者姓名：</label>
                <div class="col-sm-8">
                    <input name="resName" class="form-control" type="text" required>
                </div>
            </div>
  
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">面试者性别：</label>
                <div class="col-sm-8">
                    <select name="resSex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            
           <div class="form-group">   
                <label class="col-sm-3 control-label is-required">联系电话：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="resTel" name="resTel" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11">
                        <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                    </div>
                    <!-- <input name="resTel" class="form-control" type="text" required> -->
                </div>
            </div>

            <!-- <div class="form-group">
                <label class="col-sm-4 control-label">手机号码：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="phonenumber" name="phonenumber" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11">
                        <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                    </div>
                </div>
            </div> -->
            <div class="form-group">    
                <label class="col-sm-3 control-label">学历：</label>
                <div class="col-sm-8">
<!--                    <input name="resDegree" class="form-control" type="text">-->
                    <select id="resDegree" name="resDegree" class="form-control " >
                        <option value="专科" >专科</option>
                        <option value="本科" selected>本科</option>
                        <option value="硕士">硕士</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">毕业时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="resGdate" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">毕业院校：</label>
                <div class="col-sm-8">
                    <input name="resGraduate" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">专业：</label>
                <div class="col-sm-8">
<!--                    <input name="resSpeciality" class="form-control" type="text">-->
                    <select id="resSpeciality" name="resSpeciality" class="form-control select2-multiple" multiple>
                        <option value="国际英语" >国际英语</option>
                        <option value="国际日语">国际日语</option>
                        <option value="软件工程">软件工程</option>
                        <option value="计算机科学">计算机科学</option>
                        <option value="土木工程">土木工程</option>


                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">主要技术：</label>
                <div class="col-sm-8">
<!--                    <input name="resTechnology" class="form-control" type="text">-->
                    <select id="resTechnology" name="resTechnology" class="form-control select2-multiple" multiple>
                        <option value="C#" >C#</option>
                        <option value="Java">Java</option>
                        <option value="Python">Python</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">语言水平：</label>
                <div class="col-sm-8">
<!--                    <input name="resLanguage" class="form-control" type="text">-->
                    <select id="resLanguage" name="resLanguage" class="form-control " >
                        <option value="N1" >N1</option>
                        <option value="N2">N2</option>
                        <option value="N3">N3</option>
                        <option value="英语四级">英语四级</option>
                        <option value="英语六级">英语六级</option>
                        <option value="英语八级">英语八级</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">现在的公司：</label>
                <div class="col-sm-8">
                    <input name="resCompany" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">简历的来源：</label>
                <div class="col-sm-8">
                    <!-- <input name="resOrigin" class="form-control" type="text" required> -->
                    <select id="resOrigin" name="resOrigin" class="form-control " >
                        <option value="1" >内部推荐</option>
                        <option value="2">HR</option>
                        <option value="3">社会招聘</option>
                    </select>
                </div>
            </div>
            <!-- <div class="form-group">    
                <label class="col-sm-3 control-label">内部推荐人：</label>
                <div class="col-sm-8">
                    <input name="resUser" class="form-control" type="text">
                </div>
            </div> -->
           
            <div class="form-group">
                <label class="col-sm-3  control-label">内部推荐人：</label>
                <div class="col-sm-8">
                    <select id="resUser" name="resUser" class="form-control select2" >
                        <option th:each="user:${user}" th:value="${user.userId}" th:text="${user.userName}" th:disabled="${user.status == '1'}"></option>
                    </select>
                </div>
            </div>

            <!-- <div class="form-group">    
                <label class="col-sm-3 control-label">简历执行人 负责人：</label>
                <div class="col-sm-8">
                    <input name="resAction" class="form-control" type="text">
                </div>
            </div> -->

            <div class="form-group">
                <label class="col-sm-3  control-label">负责人：</label>
                <div class="col-sm-8">
                    <select id="resAction" name="resAction" class="form-control select2" >
                        <option th:each="user:${user}" th:value="${user.userId}" th:text="${user.userName}" th:disabled="${user.status == '1'}"></option>
                    </select>
                </div>
            </div>
            <!-- <div class="form-group">    
                <label class="col-sm-3 control-label">参考的ban范围：</label>
                <div class="col-sm-8">
                    <input name="resBan" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">参考的职位：</label>
                <div class="col-sm-8">
                    <input name="resJob" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">添加人：</label>
                <div class="col-sm-8">
                    <input name="cu" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">添加时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="ct" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">修改人：</label>
                <div class="col-sm-8">
                    <input name="uu" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">修改时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="ut" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">删除标志：</label>
                <div class="col-sm-8">
                    <input name="delFlag" class="form-control" type="text">
                </div>
            </div> -->
            <h4 class="form-header h4">comments信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
            <div class="layui-layer-btn layui-layer-btn-">
                <a class="layui-layer-btn0" onclick="javaScript:submitHandler();">确定</a>
                <!-- location.reload(); 刷新界面 查找成功后刷新 -->
                <a class="layui-layer-btn1" onclick="javaScript:$.form.reset();" >重置</a>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/resume"
        $("#form-resume-add").validate({
            // focusCleanup: true
            onkeyup: false,
        	rules:{
                resTel:{
        			isPhone:true,
                    remote: {
                        url: prefix + "/checkPhoneUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "resTel": function () {
                                return $.common.trim($("#resTel").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},

            },
        	messages: {
        		"resTel":{
                	remote: "手机号码已经存在"
        		}
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-resume-add').serialize());
            }
        }

        $("input[name='resGdate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='ct']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='ut']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/upload',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })

        $(function() {
            var options = {
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'comText',
                    align: 'center',
                    title: '备注描述',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='commentsList[%s].comText' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
                    }
                }]
            };
            $.table.init(options);
        });

        function addRow() {
            var count = $("#" + table.options.id).bootstrapTable('getData').length;
            var row = {
                index: $.table.serialNumber(count),
                comText: "",
                cu: "",
                ct: "",
                uu: "",
                ut: "",
            }
            sub.addRow(row);
        }
    </script>
</body>
</html>